<script setup lang="ts">
import { useUserInfoStore } from '@/store/userInfo'

const router = useRouter()
const userInfoStore = useUserInfoStore()

onLoad((options) => {
  const token = options?.token
  if (token) {
    userInfoStore.setUserInfo({
      token,
      nickname: '',
      avatar: '',
      mobile: '',
    })
  }

  if (userInfoStore.userInfo?.token)
    router.replaceAll('home')
  else
    router.replaceAll('login')
})
</script>

<template>
  <view class="h-screen bg-white" />
</template>

<style></style>

<route type="home" lang="yaml">
name: 'index'
</route>
